<html>
  <head>
    <title>Ubiquity Parser 2 Playpen</title>
    <link rel="shortcut icon" href="chrome://ubiquity/skin/icons/favicon.ico" type="image/x-icon" />
    <script type="text/javascript;version=1.8" charset='utf-8' src='resource://ubiquity/scripts/jquery.js'></script>
    <script type="text/javascript;version=1.8" 
     src="resource://ubiquity/modules/parser/new/parser.js"></script>
    <script type="text/javascript;version=1.8" charset='utf-8' src='playpen.js'></script>
    <style type="text/css">
			body {
				background-color: #ddd;
				padding: 0px;
				margin: 0px;
				font-family: sans-serif;
			}
			
			h1, h2, h3, .large {
				color: #333;
			}
			
			h2 {
				font-variant: small-caps;
			}

      #main {
        margin: 0 auto;
        width: 800px;
        background-color: #fff;
        padding: 30px;
      }
      
      #border { border: 1px black solid; overflow-x: auto; }
      #border * { display: inline-block }
      input.input {
        border: none;
        width: auto;
        font-size: 0.9em;
        width: 100%;
      }
      
      #parseinfo, #envinfo {
        max-height: 400px;
        overflow:auto;
      }
            
      .verb {
        border-bottom: 2px blue solid;
      }
      
      .prefix {
        border-bottom: 2px orange solid;
        font-weight: bold;
      }
      
      .argument {
        border-bottom: 2px orange solid;
      }
      
      .object {
        border-bottom: 2px black solid;
      }
      
      .inactive, .needarg {
        color: gray;
      }
      
      #scoredParses {
        border: none;
      }
      
      .toggle {
        text-decoration: underline;
      }
      
      .warning {
        border: 1px red solid;
        background-color: #ddd;
        padding: 10px;
      }
      
      #parsetree {
        overflow: auto;
        width: 10000px;
      }
      
      .treeleaf {
        vertical-align: top;
        display: inline-block;
        padding: 5px;
        margin: 5px;
        padding-left: 20px;
        border: 1px gray solid;
      }
      
      .treewrap > .children {
        margin-left: 10px;
        display: inline-block;
      }
      
      .badge {
        border: 2px #ccc solid;
        width: 1em;
        text-align: center;
        -moz-border-radius: .7em;
        z-index: 2;
        position: absolute;
        background-color: #ccc;
      }

      .badge.winner {
        border: 2px yellow solid;
        background-color: yellow;
      }

      .badge.winner.badge9 {
        border: 2px red solid;
      }
      
    </style>
  </head>
  <body>
  <div id='main'>
  
    <h1>Ubiquity Parser 2 Playpen</h1>
    
    <p>This is a parser testing and optimization playpen for the upcoming Ubiquity parser.</p>
    
    <div class='warning' id='parser2' style='display:none'>You're not using Parser 2! Please <a href='chrome://ubiquity/content/settings.xhtml'>turn on Parser 2 (aka Next Generation Parser)</a>, restart Firefox, and try again.</div>

    <div class='warning' id='gubiquity' style='display:none'><code>gUbiquity</code> was not loaded properly. Most likely this means you loaded this page at the same time that you loaded the window, and this page loaded before the window chrome, in which case you can just reload this page and it should work. Otherwise, there may actually be a problem with some code.</div>
    
    <h2>Settings</h2>
    
    <div id='languages'></div>
    <div>
      <!--<input type='button' name='clearnouncache' value='clear noun cache' id='clearnouncache'></input>-->
      <label for='maxSuggestions'>max suggestions:</label><input id='maxSuggestions' value='5' size='2'/>
      <input type='checkbox' name='displayparseinfo' id='displayparseinfo'></input><label title='this will slow things down considerably' for='displayparseinfo'>display parse info</label><input type='checkbox' name='displayparsetree' id='displayparsetree'></input><label title='this will *not* affect performance' for='displayparsetree'>display parse lineage</label><input type='checkbox' name='autoparse' id='autoparse'></input><label title='this will slow things down considerably' for='autoparse'>automatically parse on update</label>
      <br/>
      <label for='gu-sync'
       title="uses the same parser as the current Ubiquity instance">
       <input type='checkbox' id='gu-sync' checked='checked'/>
       sync with <code>gUbiquity</code>
      </label>
    </div>
    
		<div id='border'>
			<input id='root' class='input'/>
		</div>
		
		<input type='button' id='run' value='run!'></input><input id='times' size='4' name='times' value='1'/> times 
		
		<br/><label for='selection'>selection text (for anaphora substitution):</label><input id='selection' name='selection'></input>

    <div>
    <h2 class='toggle'>Environment info <small>(click me to toggle)</small></h2>
    <div class='envinfo' style='display:none;'>
      <div>
        <h3 class='toggle'>Active semantic roles:</h2>
        <ul id='roles'></ul>
        <p><small>(overlapping roles with the same delimiters indicate synonymous delimiters)</small></p>
      </div>
      
      <div>
        <h3 class='toggle'>Active noun types:</h2>
        <ul id='nountypes'></ul>
        <p><small>(see source for score functions)</small></p>
      </div>

      <div>
        <h3 class='toggle'>Active verbs:</h2>
        <ul id='verblist'></ul>
      </div>
    </div>
    </div>

    <h2>Suggestions</h2>
    <p>KEY: <span class="verb">verb</span> <span class="object">object</span> <span class="prefix">prefix </span><span class="argument">argument</span> (hover over the verb to see the actual verb and over prefixes to see the associated semantic role)</p>
    <table id="scoredParses"></table>

    <h2>Current parse:</h2>
    
    <span class='current'></span>/<span class='runtimes'></span> = <span class='total'></span> ms (avg: <span class='avg'></span> ms)
    
    <div id='parseinfo'></div>

    <h2>Current query's parse tree:</h2>
    
    <div id='parsetree'></div>

  </div>
  </body>
</html>
